package actions.demo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;

/**
 * 多文件上传.
 * @author liwp.
 */
public class FileUploadExampleAction extends Action {

    /**
     * @param mapping action mapping
     * @param form action form
     * @param request http request
     * @param response http response
     * @return action forward
     * @throws Exception any exception
     */
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        DynaActionForm dynFrm = (DynaActionForm) form;
        String productName = dynFrm.getString("productName");
        String description = dynFrm.getString("description");
        request.setAttribute("productName", productName);
        request.setAttribute("description", description);
        return mapping.findForward("list");
    }

}
